<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>用户绑卡查询</title>
    <%@ include file="/WEB-INF/view/common/includ-css.jsp" %>
    <%--  <link rel="stylesheet" href="../../static/lib/layui/css/layui.css" media="all" />--%>
    <style>
        .layui-table1 {
            margin: 10px 0;
            width: 100%;
            margin: 10px 0;
            border-collapse: collapse;
        }
        .layui-table1 th {
            font-weight: 400;
            position: relative;
            padding: 9px 15px;
            min-height: 20px;
            line-height: 20px;
            font-size: 14px;
        }
    </style>
</head>
<body class="gray-bg">
<div class="row wrapper border-bottom white-bg">
    <div class="col-sm-12">
        <div class="ibox float-e-margins" style="margin-bottom: 0px;">
            <div class="ibox-title">
                <h5>查询条件</h5>
                <div class="ibox-tools">
                    <a class="collapse-link">
                        <i class="fa fa-chevron-up"></i>
                    </a>
                </div>
            </div>
            <div class="ibox-content">
                <form class="form-inline">
                    <div class="form-group">
                        <label class="font-normal">用户id：</label>
                        <input type="text" id="uid" name="uid" value="${id}"/>
                    </div>
                    <div class="form-group">
                        <label class="font-normal">alias：</label>
                        <input type="text" id="alias" name="alias"/>
                    </div>
                    <div class="form-group">
                        <label class="font-normal">卡号</label>
                        <input type="text" id="card_no" name="card_no"/>
                    </div>
                    <input type="hidden" id="statusInput"/>
                    <button type="button" class="btn btn-white btn-info btn-round" style="margin-bottom: 0px;" id="query">
                        <i class="ace-icon fa fa-search bigger-120 blue"></i>查询
                    </button>
                </form>
            </div>
        </div>
    </div>
</div>
<div class="row wrapper border-bottom white-bg page-heading">
    <div class="col-sm-4">
        <h2>用户绑卡管理</h2>
    </div>
</div>
</div>
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">

                <div class="ibox-content">
                    <table id="dataTables" class="table table-striped table-bordered table-hover">
                        <thead>
                        <tr>
                            <th>ID</th>
                            <th>用户id</th>
                            <th>昵称</th>
                            <th>卡号</th>
                            <th>银行名称</th>
                            <th>证件号</th>
                            <th>姓名</th>
                            <th>电话</th>
                            <th>时间</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody></tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>

<%@ include file="/WEB-INF/view/common/includ-js.jsp" %>
<!-- Data Tables -->
<script src="${path}/static/Hui/js/plugins/dataTables/jquery.dataTables.js"></script>
<script src="${path}/static/Hui/js/plugins/dataTables/dataTables.bootstrap.js"></script>
<script src="${path}/static/plugins/layui/layui.all.js"></script>
<script>
    $(function(){

        // 关闭错误提示
        $.fn.dataTable.ext.errMode = 'none';

        // 数据表格
        var tables = $("#dataTables").dataTable({
            paging:true,
            serverSide: true,
            searching: false,
            ordering:  false,
            processing: false,
            "lengthMenu": [10, 20, 50, 100],
            pageLength: 20,
            lengthChange: true,
            "ajax":{
                url:"/app/user/user/bank/list",
                type:"post",
                data: function (d) {
                    d.card_no=$("#card_no").val(),
                        d.id=$("#uid").val(),
                        d.alias = $("#alias").val();
                }
            },
            columns: [
                { "data": "id" },
                { "data": "user_id" },
                { "data": "nickName" },
                { "data": "card_no" },
                { "data": "bank_name","defaultContent":"" },
                { "data": "id_card_num" },
                { "data": "user_name" },
                { "data": "mobile" },
                { "data": "raw_add_time" },
                { "data": "id" },
            ],
            columnDefs: [
                {
                    "render": function(data, type, row, meta) {
                        var html = '<a href="javascript:void(0)" onclick="userBankDel(' + data + ','+row.user_id+')" class="blue" title="删除"><i class="ace-icon fa fa-pencil bigger-130">删除</i></a>';
                        return html;
                    },
                    "targets": 9
                },
            ]
        });
        $("#query").click(function(){
            tables.dataTable().fnDraw();
        });

    });
    function userBankDel(id,uid){
        var str = "是否删除银行卡信息";
        // 询问框
        layer.confirm(str, {
            btn: ['确定','取消']
        }, function(){
            $.ajax({
                type:"post",
                url:"${path}/app/user/user/bank/del",
                dataType:"json",
                data:{id:id,uid:uid},
                success:function(data){
                    if(data.code ==0){
                        layer.alert(data.msg,{icon:1}, function(){
                            location.reload();
                        });
                    }else{
                        layer.alert(data.msg,{icon:2});
                    }
                },
                error:function (data) {
                    layer.close(index);
                }
            });
        });
    }

</script>
</body>
</html>
